package com.ruoyi.common.service.business.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.pagination.Paging;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.pagination.PageInfo;
import com.ruoyi.common.param.CurrentAccountParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.mapper.business.CurrentAccountMapper;
import com.ruoyi.common.domain.business.CurrentAccount;
import com.ruoyi.common.service.business.CurrentAccountService;

/**
 * 往来账Service业务层处理
 *
 * @author Song
 * @date 2024-10-29
 */
@Service
public class CurrentAccountServiceImpl extends ServiceImpl<CurrentAccountMapper, CurrentAccount> implements CurrentAccountService {

    @Autowired
    private CurrentAccountMapper currentAccountMapper;

    /**
     * 查询往来账列表
     *
     * @param currentAccount 往来账
     * @return 往来账
     */
    public Paging<CurrentAccount> pageCurrentAccount(CurrentAccountParam currentAccount) {
        LambdaQueryWrapper<CurrentAccount> wrapper = new LambdaQueryWrapper<CurrentAccount>();
        Page<CurrentAccount> page = new PageInfo<>(currentAccount);

        IPage<CurrentAccount> iPage = this.page(page, wrapper);
        // 最终返回分页对象
//        IPage<CurrentAccountVo> resultPage = iPage.convert(item -> {
//            CurrentAccountVo vo = new CurrentAccountVo();
//            BeanUtil.copyProperties(item, vo);
//            return vo;
//        });
        return new Paging(iPage);
    }
}



